/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package anjos.conversores;

/**
 *
 * @author AlanmLira
 */


import anjos.modelo.Evento;
import anjos.rn.EventoRN;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;


public class EventoConversor implements Converter{
    private final EventoRN eventoRN = new EventoRN();

    @Override
    public Object getAsObject(FacesContext fc, UIComponent uic, String valor) {
        return eventoRN.obter(new Integer(valor));
    }

    @Override
    public String getAsString(FacesContext fc, UIComponent uic, Object o) {
        Evento local = (Evento) o;
        return local.getId().toString();
    }
}
